#include <stdio.h>
#include <stdlib.h>
#define MaxSize 25

typedef struct
{
    int data[MaxSize];
    int length;
} S_IntList;

typedef struct
{
    int *data;
    int length, ListSize;
} D_IntList;

int init2(D_IntList *L)
{
    L->data = (int *)malloc(sizeof(int) * 100);
    L->length = 0;
    L->ListSize = MaxSize;
    return 0;
}
int isempty(D_IntList *L)
{
    if (L->length == 0)
        return 1;
    else
        return 0;
}
int Insert(D_IntList *L, int i, int elem)
{
    // 1、尾插
    if (L->length <= i)
    {
        L->data[L->length] = elem;
        L->length++;
    }

    // 2、中间插
    else
    {
        int j;
        for (j = L->length - 1; j+1 >= i; j--)
        {
            L->data[j + 1] = L->data[j];
        }
        L->data[i - 1] = elem;
        L->length++;
    }
    return 0;
}

int main()
{
    D_IntList L;
    init2(&L);
    Insert(&L, 2, 5);
    Insert(&L, 1, 3);
    Insert(&L, 2, 8);
    Insert(&L, 1, 8);
 
    
    return 0;
}